package myjava.processi;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Root4 {

   public static int HOURS = 24;

   public static void main(String[] args) {


      ScheduledThreadPoolExecutor pool = new ScheduledThreadPoolExecutor(4);
      for (int i = 0; i < HOURS; i++) {
         pool.schedule(new CountDown(i), (long) i, TimeUnit.SECONDS);
      }
      pool.schedule(new Event("wake up"), (long) 8, TimeUnit.SECONDS);
      pool.schedule(new Event("lunch"), (long) 13, TimeUnit.SECONDS);
      pool.schedule(new Event("dinner"), (long) 20, TimeUnit.SECONDS);
      pool.schedule(new Event("bed"), (long) 23, TimeUnit.SECONDS);
   }
}

class CountDown implements Runnable {

   private int t;

   public CountDown(int t) {
      this.t = t;
   }

   public void run() {
      System.out.println("time : " + t);
   }
}

class Event implements Runnable {

   String m;

   public Event(String m) {
      this.m = m;
   }

   public void run() {
      System.out.println(m);
   }
}